﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace Sofire.DataComm.Net
{
    /// <summary>
    /// 表示可靠套接字接收完整数据后发生的事件委托。
    /// </summary>
    /// <param name="sender">事件对象。</param>
    /// <param name="e">事件参数。</param>
    public delegate void ReceivedEventHandler(object sender, ReceivedEventArgs e);

    /// <summary>
    /// 表示可靠套接字接收完整数据后发生的事件参数。
    /// </summary>
    public class ReceivedEventArgs : SocketEventArgs
    {
        private byte[] _Data;
        /// <summary>
        /// 获取接收的所有字节数据。
        /// </summary>
        public byte[] Data
        {
            get
            {
                return this._Data;
            }
        }

        /// <summary>
        /// 初始化 <see cref="Sofire.DataComm.Net.ReceivedEventArgs"/> 的新实例。
        /// </summary>
        /// <param name="fromSocket">发送字节数据的 <see cref="System.Net.Sockets.Socket"/>。</param>
        /// <param name="data">接收的所有字节数据。</param>
        public ReceivedEventArgs(Socket fromSocket, byte[] data):base(fromSocket)
        {
            this._Data = data;
        }
    }
}
